package com.tomhu.main;

import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

import com.tomhu.controler.BracketControler;
import com.tomhu.doservices.FilterServices;
import com.tomhu.doservices.JudgePointServices;
import com.tomhu.optimize.PointFilter;

public class Point24 {

	public static void main(String[] args) {
		// 产生4个不大于13的正整数！
		// System.out.println("请选择你想要的难度！");
		// System.out.println("1>容易		2>正常		3>困难");
		// @SuppressWarnings("resource")
		// Scanner scan = new Scanner(System.in);
		//
		// switch (scan.nextInt()) {
		// case Level.EASY:
		// // System.out.println("hejowu");
		// break;
		// case Level.NORMAL:
		// System.out.println("ourfddou");
		// break;
		// case Level.DIFFICULT:
		// System.out.println("hou");
		// break;
		// default:
		// System.out.println("ehou");
		// break;
		// }

		final int DIMENSION = 4;
		double arrays[] = new double[DIMENSION];
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		for (int i = 0; i < arrays.length; i++) {
			arrays[i] = scanner.nextInt();
		}
		
		long start = System.nanoTime();
		Set<String> Lists;
		if (new FilterServices().doFilter(arrays)) {
			Lists = new JudgePointServices().doServices(arrays, arrays.length);
			if (Lists != null) {
				Iterator<String> iterator = Lists.iterator();
				while (iterator.hasNext()) {
					BracketControler.dealWithOperate(iterator.next().split("&"));
				}
				System.out.println("一共有：" + Lists.size() + "种");
			}
		} else {
			System.out.println("不能组成24点！");
		}
		long end = System.nanoTime();
		System.out.println("time: " + (end - start));
	}

	// public static void showResult(List<String> lists) {
	//
	// for (int i = 0; i < lists.size(); i++) {
	// System.out.println(lists.get(i));
	// }
	//
	// }
}
